﻿using System;
using System.Web.UI.WebControls;
using ASPNETVN.PORTAL.Components.Configuration;
using ASPNETVN.PORTAL.Components.Security;
using ASPNETVN.PORTAL.Components.UI;

namespace ASPNETVN.PORTAL.Modules.SECURITY.Controls
{
    public partial class RoleManager : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                ddlRoles.DataSource = Role.SelectAllByPortalID(Global.PortalID);
                ddlRoles.DataBind();

                PortalDataSet ds = PortalConfiguration.GetPortalDataSet();
                foreach (PortalDataSet.ModuleRow row in ds.Module)
                {
                    ListItem item = new ListItem();
                    item.Text = string.Format("{0} ({1})", row.Title, row.ModuleDefinitionRow.Name);
                    item.Value = row.ID.ToString();
                    chkModules.Items.Add(item);
                }
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            PortalDataSet ds = PortalConfiguration.GetPortalDataSet();
            foreach (ListItem item in chkModules.Items)
            {
                if (item.Selected)
                {
                }
            }
        }
    }
}